package cn.zhangxin.newyear.system.echarts.controller;

import cn.zhangxin.newyear.system.echarts.domain.Dept;
import cn.zhangxin.newyear.system.echarts.service.IEchartsService;
import cn.zhangxin.newyear.utils.AjaxResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/echarts")
@Api(value = "报表的API",description="报表的功能")
public class EchartsController {
    @Autowired
    private IEchartsService iEchartsService;

    @GetMapping("/dept")
    public AjaxResult getDept(){
        List<Dept> depts = null;
        try {
            depts = iEchartsService.deptEcharts();
            return AjaxResult.success().setData(depts);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("获取报表数据失败");
        }
        return null;
    }
}
